<?php

if (isset ($_GET['etu'])) {

	$connexion = mysql_connect("localhost", "root", "root");
	mysql_select_db("flux_etudiants", $connexion);
	
	extract($_GET);
	getDonnee($etu);
}else{
	echo "{}";
}

function getDonnee($etu) {
	$sql = "SELECT u.login, t.code, ut.maj
		FROM flux_utitag ut
			INNER JOIN flux_uti u ON u.uti_id = ut.uti_id
			INNER JOIN flux_tag t ON t.tag_id = ut.tag_id
		WHERE u.login = '".$etu."'";
	//echo $sql;
	$rs = mysql_query($sql) or die('Requête invalide : ' . mysql_error());
	$arrG = array();
	While ($arr = mysql_fetch_array($rs)){
		$arrG[] = $arr;
	}
	echo json_encode($arrG);
	
}

?>
